package org.yx.service.sbas.view_product_process_path;

import org.dbist.dml.Page;
import org.dbist.dml.Query;
import org.yx.models.SmfrProPth;
import org.yx.utils.BaseService;

import com.xiaoleilu.hutool.util.StrUtil;

/**
 * 查询某产品的工艺路线
 * @author zxw
 * @since 2018/04/12
**/
public class SbasViewProductProcessPathService extends BaseService {
	public SbasViewProductProcessPathOut viewProductProcessPath(SbasViewProductProcessPathIn in) throws Exception {
		SbasViewProductProcessPathOut out = new SbasViewProductProcessPathOut();

		if (!StrUtil.isBlank(in.getMatCode()) && !StrUtil.isBlank(in.getMatVer())) {
			Query query = new Query(in.getPageIndex(), in.getPageSize());
			query.addFilter("orgCode", in.getUserOrgCode());
			query.addFilter("matCode", in.getMatCode());
			query.addFilter("matVer", in.getMatVer());
			query.addFilter("ignoreDelete", in.getIgnoreDelete());

			Page<SmfrProPth> pthPage = selectPageBySqlFilePath("select_product_process_path.sql", query, SmfrProPth.class);

			out.setPathList(pthPage.getList());
			out.setTotalSize(pthPage.getTotalSize());
		}

		return out;
	}
}